package com.eedi.framework.oauth2.dal.mapper;

import com.eedi.framework.mybatis.core.mapper.BaseMapperX;
import com.eedi.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.eedi.framework.oauth2.dal.dataobject.OrgOAuth2RefreshTokenDO;
import org.apache.ibatis.annotations.Mapper;

@Mapper
public interface OrgOAuth2RefreshTokenMapper extends BaseMapperX<OrgOAuth2RefreshTokenDO> {

    default int deleteByRefreshToken(String refreshToken) {
        return delete(new LambdaQueryWrapperX<OrgOAuth2RefreshTokenDO>()
                .eq(OrgOAuth2RefreshTokenDO::getRefreshToken, refreshToken));
    }

    default OrgOAuth2RefreshTokenDO selectByRefreshToken(String refreshToken) {
        return selectOne(OrgOAuth2RefreshTokenDO::getRefreshToken, refreshToken);
    }

}
